home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / QuickDraw 3D / Samples / SampleCode / TriGrids / Headers / MathUtilities.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-21  |  2.9 KB  |  80 lines  |  [TEXT/MPS ]

  1. /*     
  2.     testMathUtils.h
  3.     
  4.         Math macros copied from EscherMath.h .
  5.  
  6.     Change Log:                                                             
  7.  
  8.     09/06/94    rdd Created after the macros were removed for A1c1 API changes.
  9. */
  10.  
  11. /******************************************************************************
  12.  **                                                                             **
  13.  **                            Miscellaneous Functions                             **
  14.  **                                                                             **
  15.  *****************************************************************************/
  16.  
  17. #define uMath_DegreesToRadians(x)    ((x) *  kQ3Pi / 180.0)
  18. #define uMath_RadiansToDegrees(x)    ((x) * 180.0 / kQ3Pi)
  19.  
  20. #define uMath_Ceil(x)            ((float)ceil((double)(x)))
  21. #define uMath_Floor(x)            ((float)floor((double)(x)))
  22.  
  23. #define uMath_Min(x,y)            ((x) <= (y) ? (x) : (y))
  24. #define uMath_Max(x,y)            ((x) >= (y) ? (x) : (y))
  25.  
  26. #define uMath_Fabs(x)            ((float)fabs((double)(x)))
  27. #define uMath_Abs(x)            ((long)fabs((double)(x)))
  28.  
  29. #define uMath_Pow(x,y)            ((float)pow((double)(x),(double)(y)))
  30.  
  31. #define uMath_Sqrt(x)            ((float)sqrt((double)(x)))
  32.  
  33. #define uMath_Fmod(x,y)            ((float)fmod((double)(x),(double)(y)))
  34.  
  35. #define uMath_Frexp(x,nPtr)        ((float)frexp((double)(x),(int *)(nPtr)))
  36.  
  37. #define uMath_Ldexp(x,n)        ((float)ldexp((double)(x),(int)(n)))
  38.  
  39. #define uMath_Log10(x)            ((float)log10((double)(x)))    
  40.  
  41. #define uMath_Modf(x,nPtr)        ((float)modf((double)(x),(double *)(nPtr)))
  42.  
  43. #define uMath_Exp(x)            ((float)exp((double)(x)))
  44.  
  45. #define uMath_Log(x)            ((float)log((double)(x)))
  46.         
  47.  
  48. /******************************************************************************
  49.  **                                                                             **
  50.  **                            Trigonometric Functions                             **
  51.  **                                                                             **
  52.  *****************************************************************************/
  53.  
  54. #define uMath_Sin(x)            ((float)sin((double)(x)))
  55. #define uMath_Cos(x)            ((float)cos((double)(x)))
  56. #define uMath_Tan(x)            ((float)tan((double)(x)))
  57.  
  58. #define uMath_Asin(x)            ((float)asin((double)(x)))
  59. #define uMath_Acos(x)            ((float)acos((double)(x)))
  60. #define uMath_Atan(x)            ((float)atan((double)(x)))
  61. #define uMath_Atan2(x,y)        ((float)atan2((double)(x),(double)(y)))
  62.  
  63. #define uMath_Sinh(x)            ((float)sinh((double)(x)))
  64. #define uMath_Cosh(x)            ((float)cosh((double)(x)))
  65. #define uMath_Tanh(x)            ((float)tanh((double)(x)))
  66.  
  67. #define uMath_Sin_Deg(x)        ((float)sin((double)Q3Math_DegreesToRadians((x))))
  68. #define uMath_Cos_Deg(x)        ((float)cos((double)Q3Math_DegreesToRadians((x))))
  69. #define uMath_Tan_Deg(x)        ((float)tan((double)Q3Math_DegreesToRadians((x))))
  70.  
  71. #define uMath_Asin_Deg(x)        ((float)Q3Math_RadiansToDegrees(asin((double)(x))))
  72. #define uMath_Acos_Deg(x)        ((float)Q3Math_RadiansToDegrees(acos((double)(x))))
  73. #define uMath_Atan_Deg(x)        ((float)Q3Math_RadiansToDegrees(atan((double)(x))))
  74. #define uMath_Atan2_Deg(x,y)    ((float)Q3Math_RadiansToDegrees(atan2((double)(x),(double)(y))))
  75.  
  76. #define uMath_Sinh_Deg(x)        ((float)sinh((double)Q3Math_DegreesToRadians((x))))
  77. #define uMath_Cosh_Deg(x)        ((float)cosh((double)Q3Math_DegreesToRadians((x))))
  78. #define uMath_Tanh_Deg(x)        ((float)tanh((double)Q3Math_DegreesToRadians((x))))
  79.  
  80.